package com.example.controller;


import com.example.common.utils.R;
import com.example.system.entity.MedicalCertificate;
import com.example.system.service.IMedicalCertificateService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 王鹤蒲
 * @since 2024-03-02
 */
@RestController
@RequestMapping("/medical-certificate")
public class MedicalCertificateController {

    @Autowired
    private IMedicalCertificateService iMedicalCertificateService;

    @ApiOperation(value = "", notes = "")
    @RequestMapping(value="/createMedicalCertificate/{orderNo}",method= RequestMethod.POST)
    @ResponseBody
    public R createMedicalCertificate(@PathVariable("orderNo") String orderNo, @RequestBody MedicalCertificate medicalCertificate){
        return iMedicalCertificateService.createMedicalCertificate(orderNo, medicalCertificate);
    }


    @ApiOperation(value = "", notes = "")
    @RequestMapping(value="/downloadMedicalCertificate/{certificateNo}",method= RequestMethod.GET)
    public void downloadMedicalCertificate(@PathVariable("certificateNo") String certificateNo, HttpServletResponse response){
       iMedicalCertificateService.downloadMedicalCertificate(certificateNo,response);
    }
}

